Skip to content

ENH: Improved threadsafe messaging #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 30, 2025
Merged

Conversation

JDuffeyBQ
Copy link
Collaborator

Switched to spdlog for processing messages from filters on a separate thread

JDuffeyBQ and others added 10 commits June 24, 2025 10:13
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
…puteArrayHistogramByFeature.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@imikejackson imikejackson force-pushed the feature/threadsafe_messaging branch from c0db31d to 11cba58 Compare June 24, 2025 14:13
@JDuffeyBQ JDuffeyBQ marked this pull request as ready for review June 24, 2025 17:22
@JDuffeyBQ JDuffeyBQ requested a review from imikejackson June 24, 2025 17:22
@imikejackson
Copy link
Contributor

ProgressMessenger progressMessenger = m_ProgressMessageHelper.createProgressMessenger();
progressMessenger.sendProgressMessage(counter);

Is that chunk thread safe? Because it is getting called from multiple threads.

Signed-off-by: Jared Duffey <[email protected]>
@JDuffeyBQ
Copy link
Collaborator Author

ProgressMessenger progressMessenger = m_ProgressMessageHelper.createProgressMessenger();
progressMessenger.sendProgressMessage(counter);

Is that chunk thread safe? Because it is getting called from multiple threads.

Yes. An atomic variable is used to store the total progress, and the actual messaging is thread safe using spdlog. And the other data stored inside ProgressMessenger is not shared so there is not issue.

* Fixed progress message template doc comment

Signed-off-by: Jared Duffey <[email protected]>
Signed-off-by: Jared Duffey <[email protected]>
@JDuffeyBQ JDuffeyBQ force-pushed the feature/threadsafe_messaging branch from e97bca8 to b636836 Compare June 26, 2025 16:32
Signed-off-by: Jared Duffey <[email protected]>
* Now use thread pool specifically for filter messaging instead of
spdlog's global pool

Signed-off-by: Jared Duffey <[email protected]>
@imikejackson imikejackson self-requested a review June 30, 2025 17:34
@JDuffeyBQ JDuffeyBQ merged commit 7ed7e81 into develop Jun 30, 2025
7 checks passed
@JDuffeyBQ JDuffeyBQ deleted the feature/threadsafe_messaging branch June 30, 2025 17:59
nyoungbq pushed a commit to nyoungbq/simplnx that referenced this pull request Jul 18, 2025
* Updated vcpkg with spdlog

Signed-off-by: Jared Duffey <[email protected]>

* Added spdlog to cmake

Signed-off-by: Jared Duffey <[email protected]>

* Changed IFilter::MessageHandler to move string

Signed-off-by: Jared Duffey <[email protected]>

* Added MessageHelper

Signed-off-by: Jared Duffey <[email protected]>

* Updated filters

Signed-off-by: Jared Duffey <[email protected]>

* Fixed formatting

Signed-off-by: Jared Duffey <[email protected]>

* Fixed missing override

Signed-off-by: Jared Duffey <[email protected]>

* Fixed incomplete type error on gcc/clang

Signed-off-by: Jared Duffey <[email protected]>

* Fixed incorrect parameter

Signed-off-by: Jared Duffey <[email protected]>

* Update src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeArrayHistogramByFeature.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Added doc comments

Signed-off-by: Jared Duffey <[email protected]>

* Added ThrottleSink to further reduce message output

Signed-off-by: Jared Duffey <[email protected]>

* Switched percent calculation to return float32

* Fixed progress message template doc comment

Signed-off-by: Jared Duffey <[email protected]>

* Let thread pool persist for multiple filters

Signed-off-by: Jared Duffey <[email protected]>

* Fixed formatting

Signed-off-by: Jared Duffey <[email protected]>

* Fixed shadowing on gcc

Signed-off-by: Jared Duffey <[email protected]>

* Fixed thread pool race condition

* Now use thread pool specifically for filter messaging instead of
spdlog's global pool

Signed-off-by: Jared Duffey <[email protected]>

---------

Signed-off-by: Jared Duffey <[email protected]>
Co-authored-by: Michael Jackson <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants